<?php

/*
 *    Document   : ganalytics
 *   Created on : Jun 20, 2011, 4:57:16 PM
 *    Author     : ClarkT AKA FalleN
 *    Web        : http://www.th3fallen.com
 *    Copyright  : 2011
 */

/*
 *  Admin ganalytics
 */

class Analytics extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->library('ganalytics');
        $this->config->load('config');
    }

    function index() {
        $month = date('m');
        $year = date('Y');
        $this->ganalytics->login($this->config->item('email'), $this->config->item('password')); // change
        $this->ganalytics->setProfileById($this->config->item('id')); // change
        $this->ganalytics->setMonth($month, $year);

        $data = array(
            'visitors' => $this->ganalytics->getVisitors(),
            'pageviews' => $this->ganalytics->getPageviews(),
            'visitsperhour' => $this->ganalytics->getVisitsPerHour(),
            'browsers' => $this->ganalytics->getBrowsers(),
            'referrers' => $this->ganalytics->getReferrers(),
            'searchwords' => $this->ganalytics->getSearchWords(),
            'screenresolutions' => $this->ganalytics->getScreenResolution(),
            'os' => $this->ganalytics->getOperatingSystem(),
            'month' => $month,
            'year' => $year
        );
        $this->template->load('templates/admin_template', 'analytics', $data, 'admin');
    }

}

?>